#pragma once
#include"RBTree.h"
namespace Z
{
	template<class K,class V>
	class map
	{
		struct MapKeyOfT
		{
			const V& operator()(const pair<K,V>& value)
			{
				return value.first;
			}
		};
	public:
		typedef typename RBTree< K, pair<K, V>, MapKeyOfT>::Iterator iterator;
		typedef typename RBTree< K, pair<K, V>, MapKeyOfT>::ConstIterator const_iterator;

		iterator begin()
		{
			return _t.Begin();
		}

		iterator end()
		{
			return _t.End();
		}

		const_iterator begin() const
		{
			return _t.Begin();
		}

		const_iterator end() const
		{
			return _t.End();
		}

		pair<iterator,bool> insert(const pair<K, V>& kv)
		{
			return _t.Insert(kv);
		}



	private:
		RBTree < K, pair<K, V>, MapKeyOfT> _t;
	};
}